package com.itheima.demo6;

/**
 * @author zzw
 * @date 2025/4/25
 * @description 合成复用原则
 */
public class Client {
    public static void main(String[] args) {
        Red red = new Red();
        White white = new White();

        PetrolCar p = new PetrolCar(red);
        System.out.println(p.move());

        PetrolCar p2 = new PetrolCar(white);
        System.out.println(p2.move());

        System.out.println("======");

        ElectricCar e = new ElectricCar(red);
        System.out.println(e.move());

        ElectricCar e2 = new ElectricCar(white);
        System.out.println(e2.move());
    }
}
